package leetcode2;

public class LargestLocal {
    public int[][] largestLocal(int[][] grid) {
        int len = grid.length;
        int[][] ans = new int[len - 2][len - 2];
        for (int i = 0; i < len - 2; i++) {
            for (int j = 0; j < len - 2; j++) {
                for (int k = i; k < i + 3; k++) {
                    for (int m = j; m < j + 3; m++) {
                        ans[i][j] = Math.max(ans[i][j], grid[k][m]);
                    }
                }
            }
        }
        return ans;
    }

}
